<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>01.ajax入门</title>
  </head>

  <body>

  </body>
  <script type="text/javascript">
    //1.创建ajax对象
    const xhr = new XMLHttpRequest();
    // 2.告诉ajax往哪里发送请求，以什么方式发送请求
    // 参数:[请求方式，请求地址]
    xhr.open('get', "http://127.0.0.1:3000/ajaxGet");
    // 3.发送ajax
    xhr.send();
    // 4.获取服务器端响应到客户端的数据
    // xhr.onreadystatechange = function () {
    xhr.onload = function () {
      console.log(xhr.response);
    }
  </script>

</html>